package main

import "fmt"

type shuiguo interface {
	show()
}

type pingguo struct{}

type xiangjiao struct{}

func (p *pingguo) show() {
	fmt.Println("pingguo")
}

func (x *xiangjiao) show() {
	fmt.Println("xiangjiao")
}

type gongchang struct {
}

func (g *gongchang) getShuiGuo(name string) shuiguo {

	var sg shuiguo

	if name == "pingguo" {
		var pg shuiguo
		pg = &pingguo{}
		return pg
	} else if name == "xiangjiao" {
		var xj shuiguo
		xj = &xiangjiao{}
		return xj
	}
	return sg
}

func main() {
	var gc gongchang
	xj := gc.getShuiGuo("xiangjiao")
	xj.show()
}
